from tortoise import fields, models

class ParameterValue(models.Model):
    parameter_value_id = fields.IntField(pk=True)
    parameter = fields.ForeignKeyField('models.Parameter', related_name='parameter_values', on_delete=fields.CASCADE)
    time_point = fields.DatetimeField()
    value = fields.DecimalField(max_digits=10, decimal_places=4, description="数值")

    class Meta:
        table = "parameter_value"

    def __str__(self):
        return f"Value {self.value} at {self.time_point}"